home *** CD-ROM | disk | FTP | other *** search
- /* -*- Mode: C; tab-width: 4 -*- */
- /* sproingiewrap.c - sproingies wrapper */
-
- /*-
- * sproingiewrap.c - Copyright 1996 Sproingie Technologies Incorporated.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation.
- *
- * This file is provided AS IS with no warranties of any kind. The author
- * shall have no liability with respect to the infringement of copyrights,
- * trade secrets or any patents by this file or any part thereof. In no
- * event will the author be liable for any lost revenue or profits or
- * other special, indirect and consequential damages.
- *
- * Programming: Ed Mackey, http://www.netaxs.com/~emackey/
- * Sproingie 3D objects modeled by: Al Mackey, al@iam.com
- * (using MetaNURBS in NewTek's Lightwave 3D v5).
- *
- * Revision History:
- * 26-Apr-97: Added glPointSize() calls around explosions, plus other fixes.
- * 28-Mar-97: Added size support.
- * 22-Mar-97: Updated to use glX interface instead of xmesa one.
- * Also, support for multiscreens added.
- * 20-Mar-97: Updated for xlockmore v4.02alpha7 and higher, using
- * xlockmore's built-in Mesa/OpenGL support instead of
- * my own. Submitted for inclusion in xlockmore.
- * 09-Dec-96: Written.
- */
-
- /*-
- * The sproingies have six "real" frames, (s1_1 to s1_6) that show a
- * sproingie jumping off a block, headed down and to the right. But
- * the program thinks of sproingies as having twelve "virtual" frames,
- * with the latter six being copies of the first, only lowered and
- * rotated by 90 degrees (jumping to the left). So after going
- * through 12 frames, a sproingie has gone down two rows but not
- * moved horizontally.
- *
- * To have the sproingies randomly choose left/right jumps at each
- * block, the program should go back to thinking of only 6 frames,
- * and jumping down only one row when it is done. Then it can pick a
- * direction for the next row.
- *
- * (Falling off the end might not be so bad either. :) )
- */
-
- # define PROGCLASS "Sproingies"
- # define HACK_INIT init_sproingies
- # define HACK_DRAW draw_sproingies
- # define sproingies_opts xlockmore_opts
- # define DEFAULTS "*delay: 100 \n" \
- "*count: 5 \n" \
- "*cycles: 0 \n" \
- "*size: 0 \n" \
- "*wireframe: False \n"
- /*
- ModeSpecOpt sproingies_opts =
- {0, NULL, 0, NULL, NULL};
-
- #ifdef USE_MODULES
- ModStruct sproingies_description =
- {"sproingies", "init_sproingies", "draw_sproingies", "release_sproingies",
- "refresh_sproingies", "init_sproingies", NULL, &sproingies_opts,
- 1000, 5, 0, 400, 4, 1.0, "",
- "Shows Sproingies! Nontoxic. Safe for pets and small children", 0, NULL};
-
- #endif
- */
- #define MINSIZE 32
-
- #include <OpenGL/glu.h>
- #include <time.h>
-
- GLuint count = 5;
- //int mono_sp = 0;
- extern int mono_sp;
- int wfmode = 0;
- int screen = 1;
-
- int cycles = 0;
-
- void
- SproingieSwap(void)
- {
- glFinish();
- }
-
-
- void
- init_sproingies()
- {
-
- int grnd = 0;
- int mspr = 0;
-
- grnd = (cycles >> 1);
- if (grnd > 2)
- grnd = 2;
-
- mspr = count;
- if (mspr > 100)
- mspr = 100;
-
- /* wireframe, ground, maxsproingies */
- InitSproingies(wfmode, grnd, mspr, 1, 1, mono_sp);
-
- DisplaySproingies();
-
- }
-
- void reshape_sproingies( int width, int height )
- {
- printf("width = %f, height = %f\n", width, height);
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(65.0, (GLfloat) width / (GLfloat) height, 0.1, 2000.0); /* was 200000.0 */
- glMatrixMode(GL_MODELVIEW);
- }
-
- /* ARGSUSED */
- void
- draw_sproingies()
- {
-
- glDrawBuffer(GL_BACK);
- NextSproingieDisplay(); /* It will swap. */
- }
-
- void
- refresh_sproingies()
- {
- /* No need to do anything here... The whole screen is updated
- * every frame anyway. Otherwise this would be just like
- * draw_sproingies, above, but replace NextSproingieDisplay(...)
- * with DisplaySproingies(...).
- */
- }
-
- void
- release_sproingies()
- {
- CleanupSproingies();
- }
-
- /* End of sproingiewrap.c */
-